<style>
    #add {
        padding: 20px 25px 25px 0;
    }

    #add .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="add">
    <form class="layui-form" action="" lay-filter="user-add-form">
        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">实验名称</label>
            <div class="layui-input-block">
                <input type="text" name="experimentName" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">考核方式</label>
            <div class="layui-input-block">
                <input type="text" name="checkType" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">实验描述</label>
            <div class="layui-input-block">
                <input type="hidden" name="remark" id="remark">
                <div id="editor">
                    <p>请输入 <b>实验内容</b> 和描述</p>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">状态：</label>
            <div class="layui-input-block">
                <input type="radio" name="state" value="1" title="有效" checked="">
                <input type="radio" name="state" value="0" title="禁用">
            </div>
        </div>

        <div class="layui-form-item febs-hide">
            <button class="layui-btn" lay-submit="" lay-filter="user-add-form-submit" id="submit"></button>
            <button type="reset" class="layui-btn" id="reset"></button>
        </div>
    </form>
</div>
<script type="text/javascript" th:src="@{febs/lay/extends/wangEditor.min.js}"></script>
<script>
    layui.use(['febs', 'form', 'validate'], function () {
        var $ = layui.$,
            febs = layui.febs,
            layer = layui.layer,
            form = layui.form,
            $view = $('#add'),
            validate = layui.validate;

        form.verify(validate);
        form.render();

        var E = window.wangEditor;
        var editor = new E('#editor');
        // 或者 var editor = new E( document.getElementById('editor') )
        editor.create();

        form.on('submit(user-add-form-submit)', function (data) {
            data.field.remark = editor.txt.text();
            febs.post(ctx + 'experiment/add', data.field, function () {
                layer.closeAll();
                febs.alert.success('新增实验成功！');
                $('#febs-user').find('#query').click();
            });
            return false;
        });
    });
</script>